package com.ruoyi.mes.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.core.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.mes.mapper.MesWorkingHoursMapper;
import com.ruoyi.mes.domain.MesWorkingHours;
import com.ruoyi.mes.service.IMesWorkingHoursService;

import javax.annotation.Resource;

/**
 * 工时管理Service业务层处理
 * 
 * @author Livon
 * @date 2021-11-09
 */
@Service
public class MesWorkingHoursServiceImpl implements IMesWorkingHoursService 
{
    @Resource
    private MesWorkingHoursMapper mesWorkingHoursMapper;

    /**
     * 查询工时管理
     * 
     * @param workingHoursUuid 工时管理主键
     * @return 工时管理
     */
    @Override
    public MesWorkingHours selectMesWorkingHoursByWorkingHoursUuid(String workingHoursUuid)
    {
        return mesWorkingHoursMapper.selectMesWorkingHoursByWorkingHoursUuid(workingHoursUuid);
    }

    /**
     * 查询工时管理列表
     * 
     * @param mesWorkingHours 工时管理
     * @return 工时管理
     */
    @Override
    public List<MesWorkingHours> selectMesWorkingHoursList(MesWorkingHours mesWorkingHours)
    {
        return mesWorkingHoursMapper.selectMesWorkingHoursList(mesWorkingHours);
    }

    /**
     * 新增工时管理
     * 
     * @param mesWorkingHours 工时管理
     * @return 结果
     */
    @Override
    public int insertMesWorkingHours(MesWorkingHours mesWorkingHours)
    {
        mesWorkingHours.setCreateBy( SecurityUtils.getUsername() ); // 创建人
        mesWorkingHours.setCreateTime(DateUtils.getNowDate());
        return mesWorkingHoursMapper.insertMesWorkingHours(mesWorkingHours);
    }

    /**
     * 修改工时管理
     * 
     * @param mesWorkingHours 工时管理
     * @return 结果
     */
    @Override
    public int updateMesWorkingHours(MesWorkingHours mesWorkingHours)
    {
        mesWorkingHours.setUpdateTime(DateUtils.getNowDate());
        return mesWorkingHoursMapper.updateMesWorkingHours(mesWorkingHours);
    }

    /**
     * 批量删除工时管理
     * 
     * @param workingHoursUuids 需要删除的工时管理主键
     * @return 结果
     */
    @Override
    public int deleteMesWorkingHoursByWorkingHoursUuids(String[] workingHoursUuids)
    {
        return mesWorkingHoursMapper.deleteMesWorkingHoursByWorkingHoursUuids(workingHoursUuids);
    }

    /**
     * 删除工时管理信息
     * 
     * @param workingHoursUuid 工时管理主键
     * @return 结果
     */
    @Override
    public int deleteMesWorkingHoursByWorkingHoursUuid(String workingHoursUuid)
    {
        return mesWorkingHoursMapper.deleteMesWorkingHoursByWorkingHoursUuid(workingHoursUuid);
    }
}
